package com.todo.strategy.pipeline.application.handler.bizAction;

import com.todo.strategy.pipeline.common.enums.StrategyActionEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author azhebuxing
 * @date 2025/3/1 05:28
 * @description
 */
@Component
public class StrategyActionFactory {

    @Autowired
    private List<AbstractStrategyActionHandle> strategyActionHandles;

    public AbstractStrategyActionHandle getStrategyActionHandle(StrategyActionEnum strategyActionEnum) {
        if (strategyActionEnum == null) {
            return null;
        }
        for (AbstractStrategyActionHandle strategyActionHandle : strategyActionHandles) {
            if (strategyActionEnum.equals(strategyActionHandle.getStrategyActionEnum())) {
                return strategyActionHandle;
            }
        }
        return null;
    }
}
